package cn.pet.service.manage.controller;


import cn.pet.service.manage.common.Response;
import cn.pet.service.manage.entity.api.Result;
import cn.pet.service.manage.entity.dto.SubscribeOrderDTO;
import cn.pet.service.manage.service.PetSubscribeOrderService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 预约服务信息 前端控制器
 * </p>
 *
 * @author
 * @since 2023-02-11
 */
@RestController
@RequestMapping("/manage/petSubscribeOrder")
public class PetSubscribeOrderController {

    @Resource
    private PetSubscribeOrderService petSubscribeOrderService;

    /**
     * 订单列表
     * @param subscribeOrderDTO
     * @return
     */
    @GetMapping("list")
    public Object list(SubscribeOrderDTO subscribeOrderDTO){
        return Result.ok("success",new PageInfo<>(petSubscribeOrderService.listByPage(subscribeOrderDTO)));
    }

    /**
     * 订单列表
     * @param subscribeOrderDTO
     * @return
     */
    @GetMapping("listByUserId")
    public Object listByUserId(SubscribeOrderDTO subscribeOrderDTO){
        return Result.ok("success",petSubscribeOrderService.listByUserId(subscribeOrderDTO));
    }

    /**
     * 订单详情
     * @param id
     * @return
     */
    @GetMapping("detail/{id}")
    public Object detail(@PathVariable("id") String id){
        return Result.ok("success",petSubscribeOrderService.getDetail(id));
    }


}
